CC=g++
CFLAGS= -Wall -c
NTL_LIB= -I$(HOME)/sw/include
OBJS= main.o SQ_ring.o SQ_ZZ_pEXFactoring.o tools.o

main: $(OBJS)
	$(CC) -o main $^ -L$(HOME)/sw/lib -lntl  -lm

main.o: main.c
	$(CC) $(CFLAGS) main.c $(NTL_LIB)

SQ_ring.o: SQ_ring.c SQ_ring.h
	$(CC) $(CFLAGS) SQ_ring.c $(NTL_LIB)

SQ_ZZ_pEXFactoring.o: SQ_ZZ_pEXFactoring.c SQ_ZZ_pEXFactoring.h
	$(CC) $(CFLAGS) SQ_ZZ_pEXFactoring.c $(NTL_LIB)

tools.o: tools.c tools.h
	$(CC) $(CFLAGS) tools.c $(NTL_LIB)
	
clean-all: clean clean-garbage clean-latex

clean:
	rm -f main $(OBJS) stdout.txt log.txt list_of_int.txt 

clean-garbage:
	rm *~ primitive.element

clean-latex:
	rm PerfRes/*.tex

